﻿@model IEnumerable<SAD.Models.Food>
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@{
    string role;
    
    //get role
    if (Session["Role"] == null)
    {
        role = "user";
    }
    else
    {
        role = Session["role"].ToString();
    }
}
<style>
    .TinNhaTro {
        height: 200px;
        width: auto;
        margin: 10px;
        padding: 10px;
        border: 2px solid;
        border-radius: 25px;
        border-bottom-style: outset;
        box-shadow: 5px 5px;
        overflow: hidden;
        -webkit-transition: height 2s;
    }

    .moTa {
        text-overflow: ellipsis;
        word-wrap: break-word;
        width: inherit;
        height: inherit;
        color: orange;
    }

    .TinNhaTro:hover {
        height: 200px;
    }

    .tenCot {
        font-weight: bold;
        width: 100px;
    }
</style>
<script>
    function btnOrder() {
        alert("Hello World!");


    }
</script>
<h2>Food list</h2>


@foreach (var item in Model)
{
    <div style="padding: 5px; border-top: 1px solid red">


        <div class="TinNhaTro">
            <div style="width: 300px; height: 200px; float: left">


                <img src="@Html.DisplayFor(modelItem => item.image)" width="260px"/>
            </div>
            <div style="width: 300px; height: 200px; float: right">

                <table>
                    <tr>
                        <td style="color: red; font-size: x-large">
                            @Html.DisplayFor(modelItem => item.name)
                           
                        </td>
                    </tr>
                    <tr>
                        <td style="color: green; font-size: large">Giá :  @Html.DisplayFor(modelItem => item.price) VND
                        </td>
                    </tr>

                    <tr>
                        <td colspan="2">
                            @Html.DisplayFor(modelItem => item.description)
                        </td>
                    </tr>
                    <tr>
                        @{if (Session["AccID"] != null)
                          {
                              <td  >
                           <h3 align="center" style="border: 2px outset; border-radius: 25px; width:100px"> <a href="@Url.Action("Order","food",new{ID = item.foodID})"> Order </a> </h3>
                        </td>
                          }
                            
                        }
                        
                        @{if (role == "admin")
                          {
                              <td>    
                                <a href="@Url.Action("Update","food",new{ID = item.foodID})"> Update </a>
                            </td>
                            <td>    
                                <a href="@Url.Action("Delete","food",new{ID = item.foodID})"> Delete </a>
                            </td>
                          }
                        
                        }
                    </tr>
                </table>

            </div>


        </div>

    </div>
}
